package org.jeecg.modules.complain.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.jeecg.modules.complain.entity.Complain;
import org.jeecg.modules.complain.entity.ComplainStatus;
import org.jeecg.modules.system.entity.SysDepart;
import org.jeecg.modules.system.entity.SysPosition;
import org.jeecg.modules.system.entity.SysUser;

import java.util.List;

/**
 * @Description: 投诉管理
 * @Author: jeecg-boot
 * @Date:   2019-08-30
 * @Version: V1.0
 */
public interface ComplainMapper extends BaseMapper<Complain> {

    public List<SysPosition> listById(String projectId);
    List<Complain>  selectDetailByUser(@Param("userId")String user,@Param("status")Integer status);
    public List<SysUser> listPostion(@Param("id")String id);
    @Update("update complain set status = #{status} where id = #{complainId} and del_flag = '0'")
    Integer updateStatus(ComplainStatus complainStatus);
    @Select("select id,parent_id from sys_depart where id =(select depart_id from sys_user where id = #{userId})")
    SysDepart selectDepart(@Param("userId")String userId);
    @Select("select position_id from sys_user_position where user_id =#{userId} and del_flag='0'")
    String selectPosition(@Param("userId")String userId);

    int getTotalByProjectId(@Param("projectId") String projectId);

    int getCompleteByProjectId(@Param("projectId") String projectId);
}
